import QtQuick 1.0

QMLTwitterBase{
    id: _root

    //////////////////////////////////////////////////////////
    // properties


    //////////////////////////////////////////////////////////
    // changed


    //////////////////////////////////////////////////////////
    // signals

    signal responseSearch(string text)


    //////////////////////////////////////////////////////////
    // methods

    function search(q, callback, geocode, lang, locale
                    , page, result_type, rpp, show_user
                    , until, since_id, include_entities){
        var content = {};
        if(!isNullOrEmpty(q)){
            content.q = q;
        }
        if(!isNullOrEmpty(callback)){
            content.callback = callback;
        }
        if(!isNullOrEmpty(geocode)){
            content.geocode = geocode;
        }
        if(!isNullOrEmpty(lang)){
            content.lang = lang;
        }
        if(!isNullOrEmpty(locale)){
            content.locale = locale;
        }
        if(!isNullOrEmpty(page)){
            content.page = page;
        }
        if(!isNullOrEmpty(result_type)){
            content.result_type = result_type;
        }
        if(!isNullOrEmpty(rpp)){
            content.rpp = rpp;
        }
        if(!isNullOrEmpty(show_user)){
            content.show_user = show_user;
        }
        if(!isNullOrEmpty(until)){
            content.until = until;
        }
        if(!isNullOrEmpty(since_id)){
            content.since_id = since_id;
        }
        if(!isNullOrEmpty(include_entities)){
            content.include_entities = include_entities;
        }
        var old_format = format;
        format = 1; //json
        requestAPI("GET", "URL_SEARCH"
                   , content, responseSearch);
        format = old_format;
    }
}
